require.config({
	urlArgs: "bust=" +  (new Date()).getTime(),
    paths : {
        "jQuery" :['/components/jquery-2.1.4'],
        'vue':['/components/vue'],
        'vTouch':['/components/vue-touch'],
        'hammerjs':['/components/hammerjs'],
        'tool':['/approve/js/tool'],
        'layer':['/components/layer'],
        'vueRouter':['/components/vue-router'],
        'text':['/components/text'],
        'components':['components'],
        'common':['/approve/common/js/vueCommon'],
        'weUi':['/components/jquery-weui'],
        'upcaseMoney':['/components/upcaseMoney'],
        'iscroll':['/components/iscroll'],
        'museUi':['/components/muse-ui']
    },
    shim:{
    	jQuery: {
             exports: 'jQuery'
        },
        vueRouter:
        {
        	deps:['vue'],
            exports:"vueRouter"
        },
        vTouch:
        {
        	deps:['hammerjs','vue'],
            exports:"vTouch"
        },
        weUi:
        {
        	deps:['jQuery'],
            exports:"weUi"
        }
    }
});

require(['jQuery','router'],function($,router){
	/*
	 * 添加dataformat
	 */
	Date.prototype.Format = function (fmt) { //author: meizz 
	    var o = {
	        "M+": this.getMonth() + 1, //月份 
	        "d+": this.getDate(), //日 
	        "h+": this.getHours(), //小时 
	        "m+": this.getMinutes(), //分 
	        "s+": this.getSeconds(), //秒 
	        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
	        "S": this.getMilliseconds() //毫秒 
	    };
	    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	    for (var k in o)
	    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	    return fmt;
	};
	$.ajax({
		type:'get',
		url:'/ding/js-config',
		data:{js_api_list:'biz.contact.choose,biz.util.open,biz.util.openSlidePanel,biz.customContact.choose,.biz.util.openLink,biz.ding.create,biz.util.uploadImage,biz.util.previewImage'},
		success:function(data)
		{
	        dd.config({
	            agentId: data.data.agentId, // 必填，微应用ID
	            corpId:  data.data.corpId,//必填，企业ID
	            timeStamp:data.data.timeStamp, // 必填，生成签名的时间戳
	            nonceStr: data.data.nonceStr, // 必填，生成签名的随机串
	            signature: data.data.signature, // 必填，签名
	            jsApiList: data.data.jsApiList// 必填，需要使用的jsapi列表
	        }); 
	        sessionStorage.setItem('corpId',data.data.corpId);
		}
	});
	
	 router.routerDemo();
});